<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/15
 * Time: 11:56
 */
/*
 * 11
 * 第1表示查看
 * 第1表示修改
 *
 */
header("Content-type:text/html;charset=utf-8");
define('M_ALL', 3);//11
define('M_READ', 2);//10
define('M_MOD', 1);//01

/*
 * 00000100
 * 00001000
 * 00010000
 */

$userPerm = M_MOD | M_READ;

//10 & 10 10
if (M_READ & $userPerm) {
    echo '<a href="#">查看</a>';
}
//01 10
if (M_MOD & $userPerm) {
    echo '<a href="#">修改</a>';
}


$result = 3 * 2 + 1 > 8 || 8 / 4 - 1 == 1;
var_dump($result);

echo sprintf('%032b',7);

$test = 7 & $userPerm;

echo sprintf('<br>%032b',$test);